import { defineStore } from "pinia";
import { ref } from "vue";

export const useRegisterStore = defineStore('register', () => {
  const fromRegister = ref(false)
  const backRegister = ref(false)
  const registerData = ref({
    phone: '',
    captcha: ''
  })

  const init = () => {
    fromRegister.value = false
    backRegister.value = false
    registerData.value.phone = ''
    registerData.value.captcha = ''
  }

  const gotoAgreement = () => {
    fromRegister.value = true
  }

  const acceptAgreement = () => {
    backRegister.value = true
  }

  const getData = (a, b) => {
    registerData.value.phone = a
    registerData.value.captcha = b
  }

  return {
    fromRegister, backRegister, registerData, init, gotoAgreement, acceptAgreement, getData
  }
})